<%@page contentType="text/html" pageEncoding="UTF-8"%>
<div id="top">
    
    <div id="search">
        <form onsubmit="return serializeForm(this)">
            <input type="hidden" name="command" value="search"/>
            <input type="text" id="autocomplete" name="postData"/>
            <div id="autocomplete_choices" class="autocomplete"></div>
            <input type="submit" value="Buscar"/>
        </form>
        
        <span class="link" onclick="showElement('advanced')">Búsqueda avanzada</span>
        <div id="advanced" style="display:none">
            <form onsubmit="return serializeForm(this)">
                <input type="hidden" name="command" value="advancedSearch"/>
                <input type="hidden" name="delivered" value=""/>
                <h4>Fecha de alta</h4>
                <p class="cal">Desde <input name="created-from" type="text" size="10"/></p>
                <p class="cal">Hasta <input name="created-to" type="text" size="10"/></p>
                <h4>Fecha de baja</h4>
                <p class="cal">Desde <input name="dropped-from" type="text" size="10"/></p>
                <p class="cal">Hasta <input name="dropped-to" type="text" size="10"/></p>
                <h4>Disponibilidad</h4>
                <p class="cal">Desde <input name="available-from" type="text" size="10"/></p>
                <p class="cal">Hasta <input name="available-to" type="text" size="10"/></p>
                <p><input id="da" name="delivered" type="checkbox"/> <strong><label for="da">Entregado</label></strong></p>
                <p>
                    <input type="submit" value="Buscar"/>
                    <span class="link red" onclick="cancelElement('advanced')">Cancelar</span>
                </p>
            </form>
        </div>
    </div>
    
    <h2>Equipos</h2>
    
</div><!--/bottom-->

<div id="middle">
    
    <div>
        <span class="link big" onclick="showElement('create')">Agregar</span>
        <span class="link" onclick="showElement('upload')">Subir muchos de un archivo</span>
    </div>
    
    <div id="create" style="display:none">
        <form onsubmit="return serializeForm(this)">
            <input type="hidden" name="command" value="create"/>
            <input type="hidden" name="delivered" value=""/>
            <table class="clean-table">
                <tr><th>Tail number</th><td><input name="tail-number" type="text" size="10"/></td></tr>
                <tr><th>Fecha de baja</th><td class="cal"><input name="drop-date" type="text" size="10"/></td></tr>
                <tr><th>Disponibilidad</th><td class="cal"><input name="available-date" type="text" size="10"/></td></tr>
                <tr><th>Entregado</th><td><input name="delivered" type="checkbox"/></td></tr>
                <tr>
                    <th colspan="2">
                        <input type="submit" value="Guardar"/>
                        <span class="link red" onclick="cancelElement('create')">Cancelar</span>
                    </th>
                </tr>
            </table>
        </form>
    </div>
    
    <iframe id="upload" src="about:blank" style="display:none"></iframe>
    
</div><!--/middle-->

<div id="bottom">
    <table id="manager" border="1">
        <thead>
            <tr>
                <th class="left" colspan="2">
                    Ver: 
                    <select id="filter" onchange="changeFilter(this)">
                        <option value="all" selected="selected">Todos</option>
                        <option value="search">Buscados</option>                   
                        <option value="delivered">Entregados</option>
                        <option value="available">Disponibles</option>
                        <option value="dropped">Baja</option>
                        <option value="maintenance">En mantenimiento</option>
                    </select>
                </th>
                <th class="right">
                    Ordenar: 
                    <select onchange="changeOrder(this)">
                        <option value="tail-number" selected="selected">Tail number</option>
                        <option value="created">Fecha de alta</option>
                        <option value="dropped">Fecha de baja</option>
                        <option value="available">Disponibilidad</option>
                        <option value="status">Status</option>
                    </select>
                </th>
            </tr>
        </thead>
    </table>
    
    <div id="list">
    </div><!--/list-->
    
</div><!--/bottom-->

<script type="text/javascript">
    controller = 'Equipments';
    filter = "all";
    order = "tail-number";
    search = null;
    loadMaintenances();
    loadAutocompleter();
    loadItems();
    observeCalInputs();
</script>

